package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/14 19:30
 * @description
 */
@Getter
@AllArgsConstructor
public enum FeedbackTypeEnum {

    REPORT(1, "REPORT", "内容举报"),
    PRODUCT_OPTIMIZATION(2, "PRODUCT_OPTIMIZATION", "产品优化"),
    PRODUCT_ROAST(3, "PRODUCT_ROAST", "产品吐槽"),
    FUNCTIONAL_SUGGESTION(4, "FUNCTIONAL_SUGGESTION", "功能建议"),
    FUNCTIONAL_ROAST(5, "FUNCTIONAL_ROAST", "功能吐槽"),

    ;

    private static Map<Integer, FeedbackTypeEnum> typeMap = Arrays
            .stream(FeedbackTypeEnum.values())
            .collect(Collectors.toMap(FeedbackTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static FeedbackTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
